import pygame


class Barrier(pygame.sprite.Sprite):
    def __init__(self, img, dims=(720, 1280), size=(200, 200), position=(200, 400)):
        super().__init__()
        self.dims = dims
        self.width, self.height = dims
        self.image = pygame.transform.scale(img, size)
        self.rect = self.image.get_rect()

        self.rect = (position[0], position[1])
        self.speed_x = 4
        self.moveLength = 0

    def update(self):
        self.rect = (self.rect[0] - 2,self.rect[1])
        if self.rect[0] < 0:
            return False
        else:
            return True

    def draw(self, screen):
        screen.blit(self.image, self.rect)